"""Definition of the agentinfo content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from my315ok.xtinfocontent import xtinfocontentMessageFactory as _

from my315ok.xtinfocontent.interfaces import Iagentinfo
from my315ok.xtinfocontent.config import PROJECTNAME

agentinfoSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-




    atapi.StringField(
        'category',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"info category"),
            description=_(u""),
        ),
    ),
    atapi.TextField(
        'text',
        storage=atapi.AnnotationStorage(),
        default_output_type = 'text/html',
        widget=atapi.RichWidget(
            label=_(u"information content"),
            description=_(u""),
        ),
    ),

))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

agentinfoSchema['title'].storage = atapi.AnnotationStorage()
agentinfoSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(agentinfoSchema, moveDiscussion=False)


class agentinfo(base.ATCTContent):
    """medium agent published information"""
    implements(Iagentinfo)

    meta_type = "agentinfo"
    schema = agentinfoSchema
    _at_rename_after_creation = True

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    text = atapi.ATFieldProperty('text')

    category = atapi.ATFieldProperty('category')


atapi.registerType(agentinfo, PROJECTNAME)
